package com.expdatacloud.vo;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 质检合格未上架看板VO
 *
 * @author jie
 * @date 2019/12/2 -15:28
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UnQualifiedQualityVo {

    /**
     * 据点
     */
    @Excel(name = "据点", height = 20, width = 30)
    private String storerkey;

    /**
     * 收货单
     */
    @Excel(name = "收货单", height = 20, width = 30)
    private String receiptKey;

    /**
     * 送货单号
     */
    @Excel(name = "送货单号", height = 20, width = 30)
    private String deliveryNumber;

    /**
     * 单据类型
     */
    @Excel(name = "单据类型", height = 20, width = 30)
    private String voucherType;

    /**
     * 收货日期
     */
    @Excel(name = "收货日期", height = 20, width = 30)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date receivingDate;

    /**
     * 收货员
     */
    @Excel(name = "收货员", height = 20, width = 30)
    private String receivingClerk;

    /**
     * 供应商代码
     */
    @Excel(name = "供应商代码", height = 20, width = 30)
    private String supplierCode;

    /**
     * 供应商简称
     */
    @Excel(name = "供应商简称", height = 20, width = 30)
    private String supplierShort;

    /**
     * 采购订单
     */
    @Excel(name = "采购订单", height = 20, width = 30)
    private String purchaseOrder;

    /**
     * 采购项次
     */
    @Excel(name = "采购项次", height = 20, width = 30)
    private String purchaseItems;

    /**
     * 品号
     */
    @Excel(name = "品号", height = 20, width = 30)
    private String sku;

    /**
     * 品名
     */
    @Excel(name = "品名", height = 20, width = 30)
    private String descr;

    /**
     * 规格
     */
    @Excel(name = "规格", height = 20, width = 30)
    private String specification;

    /**
     * 计划收货数量
     */
    @Excel(name = "计划收货数量", height = 20, width = 30)
    private String goodsQuantity;

    /**
     * 单位
     */
    @Excel(name = "单位", height = 20, width = 30)
    private String unit;

    /**
     * 已上架数量
     */
    @Excel(name = "已上架数量", height = 20, width = 30)
    private String putawayQty;

    /**
     * 待上架数量
     */
    @Excel(name = "待上架数量", height = 20, width = 30)
    private String unPutawayQty;

    public String getUnPutawayTime() {
        if (addDate != null) {
            SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            //显示几小时未上架 天 时 分
            Date endDate = new Date();
            //显示几小时未上架 天 时 分
            long nd = 1000 * 24 * 60 * 60;
            long nh = 1000 * 60 * 60;
            long nm = 1000 * 60;
            // long ns = 1000;
            // 获得两个时间的毫秒时间差异

            long diff = endDate.getTime() - addDate.getTime();
            // 计算差多少天
            long day = diff / nd;
            // 计算差多少小时
            long hour = diff % nd / nh;
            // 计算差多少分钟
            long min = diff % nd % nh / nm;
            // 计算差多少秒//输出结果
            return day + "天" + hour + "小时" + min + "分钟";
        }
        return null;
    }

    /**
     * 未上架时间
     */
    @Excel(name = "未上架时间", height = 20, width = 30)
    private String unPutawayTime;

    /**
     * 收货时间
     */
    @Excel(name = "收货时间", height = 20, width = 30)
    private String receiveTime;


    private Date addDate;
}
